// 小程序请求
import request from '@/utils/request'

// 展示轮播图列表
export function appLetsFirstpageHead(param) {
  return request({
    url: '/operate/appLetsFirstpageHead/getList',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'get',
    params: param
  })
}

// 上传轮播图
export function uploadImg(param) {
  return request({
    url: '/ids/pub/file/uploadFile',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    method: 'post',
    data: param
  })
}

// 添加轮播图
export function addLBT(param) {
  return request({
    url: '/operate/appLetsFirstpageHead/save',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data: param
  })
}

// 修改轮播图
export function modiftLBT(param) {
  return request({
    url: '/operate/appLetsFirstpageHead/update',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data: param
  })
}

// 撤销轮播图
export function deleteLBT(param) {
  return request({
    url: '/operate/appLetsFirstpageHead/delete',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    params: param
  })
}

//////////////////////////////    首页功能入口   //////////////////////////////////////

// 获取商品列表
export function getFunctionList(params) {
  return request({
    url: '/operate/firstpageIns/getList',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'get',
    params: params
  })
}

// 获取商品分类
export function getGoodsClassify() {
  return request({
    url: '/operate/firstpageIns/getCat',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'get'
  })
}

// 添加功能入口
export function addFunction(data) {
  return request({
    url: '/operate/firstpageIns/save',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data
  })
}

// 修改功能入口
export function updateFunction(data) {
  return request({
    url: '/operate/firstpageIns/update',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data
  })
}

// 删除功能入口
export function deleteFunction(data) {
  return request({
    url: '/operate/firstpageIns/delete',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data
  })
}

// 删除功能入口下的商品
export function deleteFunctionItem(data) {
  return request({
    url: '/operate/firstpageInDetails/delete',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data
  })
}
